Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Programmer's Overview / Part 1 - Getting Started With QuickDraw GX
Chapter 2 - A Quick & Easy Sample Program


Setting the Color of the Curve

Another property of your curve shape object is the reference to its ink object. One of the properties of the ink object is the color property, which contains a data structure that specifies the color that QuickDraw GX should use when drawing the curve.

This structure is defined by the gxColor data type, which contains three fields:

Color components range from 0 (no intensity) to 0xFFFF (maximum intensity). To set your curve's color to a medium gray, you can use this sample color structure definition and this setting for the color structure's fields:

gxColor halfGray;
halfGray.space = gxGraySpace;   /* color space is grayspace */
halfGray.profile = nil;         /* no color-matching */
halfGray.element.gray = 0x8000; /* 50% intensity */
Once you have created a color structure, call the GXSetShapeColor function to copy its information into the color property of the ink object referenced by your curve shape:

GXSetShapeColor(aCurveShape, &halfGray);
The GXSetShapeColor function works analogously to the GXSetShapePen function, it

  1. finds the ink object referenced by your curve shape's ink property
  2. copies color information from the halfGray color structure into the color property of the ink object

This function affects only the color property of the ink object; no other properties are affected and there are no visible results until you draw the curve.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help